home *** CD-ROM | disk | FTP | other *** search
/ Amiga Developer CD 2.1 / Amiga Developer CD v2.1.iso / Reference / Amiga_Mail_Vol2 / VIII-51 / include / devices / sana2.h next >
Encoding:
C/C++ Source or Header  |  1999-10-27  |  7.1 KB  |  254 lines

  1. #ifndef SANA2_SANA2DEVICE_H
  2. #define SANA2_SANA2DEVICE_H 1
  3. /*
  4. **    $Filename: devices/sana2.h $
  5. **    $Revision: 1.10 $
  6. **    $Date: 92/01/10 15:10:05 $
  7. **
  8. **    Structure definitions for SANA-II devices.
  9. **
  10. **    (C) Copyright 1991-1999 Amiga, Inc.
  11. **        All Rights Reserved
  12. */
  13.  
  14.  
  15. #ifndef EXEC_TYPES_H
  16. #include <exec/types.h>
  17. #endif
  18.  
  19. #ifndef EXEC_PORTS_H
  20. #include <exec/ports.h>
  21. #endif
  22.  
  23. #ifndef EXEC_IO_H
  24. #include <exec/io.h>
  25. #endif
  26.  
  27. #ifndef EXEC_ERRORS_H
  28. #include <exec/errors.h>
  29. #endif
  30.  
  31. #ifndef DEVICES_TIMER_H
  32. #include <devices/timer.h>
  33. #endif
  34.  
  35. #ifndef UTILITY_TAGITEM_H
  36. #include <utility/tagitem.h>
  37. #endif
  38.  
  39.  
  40. #define SANA2_MAX_ADDR_BITS    (128)
  41. #define SANA2_MAX_ADDR_BYTES    ((SANA2_MAX_ADDR_BITS+7)/8)
  42.  
  43. struct IOSana2Req
  44. {
  45.     struct IORequest ios2_Req;
  46.     ULONG ios2_WireError;        /* wire type specific error    */
  47.     ULONG ios2_PacketType;        /* packet type            */
  48.     UBYTE ios2_SrcAddr[SANA2_MAX_ADDR_BYTES];    /* source addr    */
  49.     UBYTE ios2_DstAddr[SANA2_MAX_ADDR_BYTES];    /* dest address    */
  50.     ULONG ios2_DataLength;        /* length of packet data    */
  51.     VOID *ios2_Data;        /* packet data            */
  52.     VOID *ios2_StatData;        /* statistics data pointer    */
  53.     VOID *ios2_BufferManagement;    /* see SANA-II OpenDevice adoc    */
  54. };
  55.  
  56.  
  57. /*
  58. ** defines for the ios2_Flags field
  59. */
  60. #define SANA2IOB_RAW    (7)        /* raw packet IO requested    */
  61. #define SANA2IOF_RAW    (1<<SANA2IOB_RAW)
  62.  
  63. #define    SANA2IOB_BCAST    (6)        /* broadcast packet (received)    */
  64. #define    SANA2IOF_BCAST    (1<<SANA2IOB_BCAST)
  65.  
  66. #define    SANA2IOB_MCAST    (5)        /* multicast packet (received)    */
  67. #define    SANA2IOF_MCAST    (1<<SANA2IOB_MCAST)
  68.  
  69. #define SANA2IOB_QUICK    (IOB_QUICK)    /* quick IO requested (0)    */
  70. #define SANA2IOF_QUICK    (IOF_QUICK)
  71.  
  72.  
  73. /*
  74. ** defines for OpenDevice() flags
  75. */
  76. #define SANA2OPB_MINE    (0)        /* exclusive access requested    */
  77. #define SANA2OPF_MINE    (1<<SANA2OPB_MINE)
  78.  
  79. #define SANA2OPB_PROM    (1)        /* promiscuous mode requested    */
  80. #define SANA2OPF_PROM    (1<<SANA2OPB_PROM)
  81.  
  82.  
  83. /*
  84. ** defines for OpenDevice() tags
  85. */
  86. #define S2_Dummy    (TAG_USER + 0xB0000)
  87.  
  88. #define S2_CopyToBuff    (S2_Dummy + 1)
  89. #define S2_CopyFromBuff    (S2_Dummy + 2)
  90.  
  91.  
  92. struct Sana2DeviceQuery
  93. {
  94. /*
  95. ** Standard information
  96. */
  97.     ULONG    SizeAvailable;        /* bytes available        */
  98.     ULONG    SizeSupplied;        /* bytes supplied        */
  99.     ULONG    DevQueryFormat;        /* this is type 0        */
  100.     ULONG    DeviceLevel;        /* this document is level 0    */
  101. /*
  102. ** Common information
  103. */
  104.     UWORD    AddrFieldSize;        /* address size in bits        */
  105.     ULONG    MTU;            /* maximum packet data size    */
  106.     ULONG    BPS;            /* line rate (bits/sec)        */
  107.     ULONG    HardwareType;        /* what the wire is        */
  108. /*
  109. ** Format specific information
  110. */
  111. };
  112.  
  113.  
  114. /*
  115. ** defined Hardware types
  116. **
  117. **  If your hardware type isn't listed below contact CATS to get a new
  118. **  type number added for your hardware.
  119. */
  120. #define S2WireType_Ethernet        1
  121. #define S2WireType_IEEE802        6
  122. #define S2WireType_Arcnet        7
  123. #define S2WireType_LocalTalk        11
  124.  
  125. #define S2WireType_AmokNet        200
  126.  
  127. #define S2WireType_PPP            253
  128. #define S2WireType_SLIP            254
  129. #define S2WireType_CSLIP        255
  130.  
  131.  
  132. struct Sana2PacketTypeStats
  133. {
  134.     ULONG PacketsSent;        /* transmitted count        */
  135.     ULONG PacketsReceived;        /* received count        */
  136.     ULONG BytesSent;        /* bytes transmitted count    */
  137.     ULONG BytesReceived;        /* bytes received count        */
  138.     ULONG PacketsDropped;        /* packets dropped count    */
  139. };
  140.  
  141.  
  142. struct Sana2SpecialStatRecord
  143. {
  144.     ULONG Type;            /* statistic identifier        */
  145.     ULONG Count;            /* the statistic        */
  146.     char *String;            /* statistic name        */
  147. };
  148.  
  149.  
  150. struct Sana2SpecialStatHeader
  151. {
  152.     ULONG RecordCountMax;        /* room available        */
  153.     ULONG RecordCountSupplied;    /* number supplied        */
  154.     /* struct Sana2SpecialStatRecord[RecordCountMax]; */
  155. };
  156.  
  157.  
  158. struct Sana2DeviceStats
  159. {
  160.     ULONG PacketsReceived;        /* received count        */
  161.     ULONG PacketsSent;        /* transmitted count        */
  162.     ULONG BadData;            /* bad packets received        */
  163.     ULONG Overruns;            /* hardware miss count        */
  164.     ULONG UnknownTypesReceived;    /* orphan count            */
  165.     ULONG Reconfigurations;        /* network reconfigurations    */
  166.     struct timeval LastStart;    /* time of last online        */
  167. };
  168.  
  169.  
  170. /*
  171. ** Device Commands
  172. */
  173. #define S2_START        (CMD_NONSTD)
  174.  
  175. #define S2_DEVICEQUERY        (S2_START+ 0)
  176. #define S2_GETSTATIONADDRESS    (S2_START+ 1)
  177. #define S2_CONFIGINTERFACE    (S2_START+ 2)
  178. #define S2_ADDMULTICASTADDRESS    (S2_START+ 5)
  179. #define S2_DELMULTICASTADDRESS    (S2_START+ 6)
  180. #define S2_MULTICAST        (S2_START+ 7)
  181. #define S2_BROADCAST        (S2_START+ 8)
  182. #define S2_TRACKTYPE        (S2_START+ 9)
  183. #define S2_UNTRACKTYPE        (S2_START+10)
  184. #define S2_GETTYPESTATS        (S2_START+11)
  185. #define S2_GETSPECIALSTATS    (S2_START+12)
  186. #define S2_GETGLOBALSTATS    (S2_START+13)
  187. #define S2_ONEVENT        (S2_START+14)
  188. #define S2_READORPHAN        (S2_START+15)
  189. #define S2_ONLINE        (S2_START+16)
  190. #define S2_OFFLINE        (S2_START+17)
  191.  
  192. #define S2_END            (S2_START+18)
  193.  
  194.  
  195. /*
  196. ** defined errors for ios2_Error  (see also <exec/errors.h>)
  197. */
  198. #define S2ERR_NO_ERROR        0    /* peachy-keen            */
  199. #define S2ERR_NO_RESOURCES    1    /* resource allocation failure    */
  200. #define S2ERR_BAD_ARGUMENT    3    /* garbage somewhere        */
  201. #define S2ERR_BAD_STATE        4    /* inappropriate state        */
  202. #define S2ERR_BAD_ADDRESS    5    /* who?                */
  203. #define    S2ERR_MTU_EXCEEDED    6    /* too much to chew        */
  204. #define S2ERR_NOT_SUPPORTED    8    /* hardware can't support cmd    */
  205. #define S2ERR_SOFTWARE        9    /* software error detected    */
  206. #define S2ERR_OUTOFSERVICE    10    /* driver is OFFLINE        */
  207. /*
  208. ** From <exec/errors.h>
  209. **
  210. **    IOERR_OPENFAIL     (-1) * device/unit failed to open *
  211. **    IOERR_ABORTED     (-2) * request terminated early [after AbortIO()] *
  212. **    IOERR_NOCMD     (-3) * command not supported by device *
  213. **    IOERR_BADLENGTH     (-4) * not a valid length (usually IO_LENGTH) *
  214. **    IOERR_BADADDRESS (-5) * invalid address (misaligned or bad range) *
  215. **    IOERR_UNITBUSY     (-6) * device opens ok, but requested unit is busy *
  216. **    IOERR_SELFTEST   (-7) * hardware failed self-test *
  217. */
  218.  
  219. /*
  220. ** defined errors for ios2_WireError
  221. */
  222. #define S2WERR_GENERIC_ERROR    0    /* no specific info available    */
  223. #define    S2WERR_NOT_CONFIGURED    1    /* unit not configured        */
  224. #define S2WERR_UNIT_ONLINE    2    /* unit is currently online    */
  225. #define S2WERR_UNIT_OFFLINE    3    /* unit is currently offline    */
  226. #define    S2WERR_ALREADY_TRACKED    4    /* protocol already tracked    */
  227. #define    S2WERR_NOT_TRACKED    5    /* protocol not tracked        */
  228. #define S2WERR_BUFF_ERROR    6    /* buff mgt func returned error    */
  229. #define S2WERR_SRC_ADDRESS    7    /* source address problem    */
  230. #define S2WERR_DST_ADDRESS    8    /* destination address problem    */
  231. #define S2WERR_BAD_BROADCAST    9    /* broadcast address problem    */
  232. #define S2WERR_BAD_MULTICAST    10    /* multicast address problem    */
  233. #define S2WERR_MULTICAST_FULL    11    /* multicast address list full    */
  234. #define S2WERR_BAD_EVENT    12    /* unsupported event class      */
  235. #define S2WERR_BAD_STATDATA    13    /* statdata failed sanity check */
  236. #define S2WERR_IS_CONFIGURED    15    /* attempt to config twice      */
  237. #define S2WERR_NULL_POINTER    16    /* null pointer detected        */
  238.  
  239.  
  240. /*
  241. ** defined events
  242. */
  243. #define    S2EVENT_ERROR        (1L<<0)    /* error catch all        */
  244. #define    S2EVENT_TX        (1L<<1)    /* transmitter error catch all    */
  245. #define    S2EVENT_RX        (1L<<2)    /* receiver error catch all    */
  246. #define    S2EVENT_ONLINE        (1L<<3)    /* unit is in service        */
  247. #define    S2EVENT_OFFLINE        (1L<<4)    /* unit is not in service    */
  248. #define    S2EVENT_BUFF        (1L<<5)    /* buff mgt function error    */
  249. #define S2EVENT_HARDWARE    (1L<<6)    /* hardware error catch all    */
  250. #define S2EVENT_SOFTWARE    (1L<<7)    /* software error catch all    */
  251.  
  252.  
  253. #endif    /* SANA2_SANA2DEVICE_H */
  254.